﻿<%@ Control Language="C#" AutoEventWireup="true" Codebehind="ZoneManagement.ascx.cs"
    Inherits="NCS.Module.CMS.Admin.Zones.ZoneManagement" %>
<%@ Register Assembly="NCS.FilePickerControl" Namespace="NCS.FilePicker" TagPrefix="cc2" %>
<%@ Register Assembly="NCS.Library" Namespace="NCS.Library.Controls" TagPrefix="cc1" %>
<%@ Register Assembly="System.Web.Extensions" Namespace="System.Web.UI" TagPrefix="asp" %>

<script type="text/javascript">
function validateForm()
{
    if(document.getElementById('<%=this.txtName.ClientID %>').value.replace(/^\s+|\s+$/g, '').length == 0)
    {
        alert("Bạn cần nhập tên chuyên mục");
        return false;
    }
//    if(document.getElementById('<%=this.dropRealUrl.ClientID %>').selectedIndex <= 0)
//    {
//        var url = document.getElementById('<% = this.txtZoneUrl.ClientID %>').value;
//        url = url.replace(/^\s+\s+$/g, '');
//        if(url.length == 0)
//        {
//            alert("Bạn cần chọn URL thực");
//            return false;
//        }
//    }
    return true;
}
function confimDelete()
{
    if(document.getElementById('<%= this.txtID.ClientID %>'))
    {
        if(document.getElementById('<%= this.txtID.ClientID %>').value.length > 0)
        {
            if(window.confirm('Bạn có thực sự muốn xóa chuyên mục này không?'))
            {
                return true;
            }
        }
    }
    return false;
}
</script>

<asp:UpdatePanel ID="uppanelDistribution" runat="server" UpdateMode="Conditional"
    RenderMode="Inline">
    <triggers>
        <asp:AsyncPostBackTrigger ControlID="lstZones" EventName="SelectedIndexChanged" />        
    </triggers>
    <contenttemplate>
<table id="Table2" border="0" width="100%" cellpadding="2" cellspacing="2">    
    <tr>
        <td class="InputBox" valign="top" width="200" style="height: 100%; width:30%;">
            &nbsp;<asp:ListBox ID="lstZones" runat="server" AutoPostBack="True" Height="100%" Rows="25" Width="95%"
                OnSelectedIndexChanged="lstZones_SelectedIndexChanged"></asp:ListBox>&nbsp;               
        </td>
        <td valign="top" style="height: 577px; width:70%;" class="InputBox" >
            <table id="Table1" class="NavBtn" width="100%" >
                <tr>
                    <td colspan="2" style="width:100%;">
                        <asp:Label ID="lblStatusUpdate" runat="server"></asp:Label>
                        <cc1:GridView ID="dtgZones" runat="server" AutoGenerateColumns="False" BorderColor="Gainsboro"
                            BorderStyle="solid" BorderWidth="1px" CaptionAlign="Top" CellPadding="2" CssClass="Grid"
                            OnRowCommand="dtgZones_RowCommand" OnRowDataBound="dtgZones_RowDataBound" Width="100%">
                            <AlternatingRowStyle CssClass="Grid_Raw2" />
                            <RowStyle CssClass="Grid_Raw1" />
                            <HeaderStyle CssClass="Grid_Top" Font-Bold="True" />
                            <Columns>
                                <asp:BoundField HeaderText="ID" DataField="Zone_ID" Visible="true" HeaderStyle-Width="10%" />
                                <asp:BoundField HeaderText="Tên" DataField="Zone_Name" HeaderStyle-Width="80%" />
                                <asp:TemplateField HeaderText="Thứ tự" HeaderStyle-Width="10%">
                                    <headertemplate>
												<asp:Button ID="cmdUpdateOrder" runat="server" Width="60px" Text="Thứ tự" CommandName="updateOrder"
													CssClass="Button"></asp:Button>
											</headertemplate>
                                    <itemtemplate>
												<asp:DropDownList ID="dropOrder" runat="server" Width="60px">
												</asp:DropDownList>
											</itemtemplate>
                                </asp:TemplateField>
                            </Columns>
                        </cc1:GridView>
                    </td>
                </tr>
                <tr>
                <td colspan="2">
                <table border="0" cellpadding="0" cellspacing="0" width="100%">
                <tr>
                    <td>
                        Tên chuyên mục</td>
                    <td>
                        <asp:TextBox ID="txtName" runat="server" Width="265"></asp:TextBox><asp:TextBox ID="txtID"
                            runat="server" Enabled="False" Visible="False" Width="10px"></asp:TextBox></td>
                </tr>
                 <tr>
                    <td>
                        Alias</td>
                    <td>
                        <asp:TextBox ID="txtZoneAlias" runat="server" Width="265"></asp:TextBox></td>
                </tr>
                <tr>
                    <td>
                        Ảnh đại diện
                    </td>
                    <td>
                        <cc2:FilePicker ID="txtAvatar" runat="server" Width="248px" fpPopupURL="/FilePicker/TUFilePicker.aspx"></cc2:FilePicker>
                    </td>
                </tr>
                <tr>
                    <td>
                       Đường dẫn trực tiếp</td>
                    <td>
                        <asp:TextBox ID="txtZoneUrl" runat="server" Width="265"></asp:TextBox></td>
                </tr>
                <tr>
                    <td>
                        Thuộc chuyên mục</td>
                    <td>
                        <asp:DropDownList ID="dropZones" runat="server" Width="266">
                        </asp:DropDownList></td>
                </tr>
                <tr>
                    <td>
                        Giao diện</td>
                    <td>
                        <asp:DropDownList ID="dropRealUrl" runat="server" Width="266">
                        </asp:DropDownList></td>
                </tr>
                <tr>
                    <td>
                        Kiểu hiển thị</td>
                    <td>
                        <asp:DropDownList ID="dropType" runat="server" Width="266px">
                            <asp:ListItem Value="0">B&#236;nh thường</asp:ListItem>
                            <asp:ListItem Value="1">Chỉ hiện thị b&#224;i nổi bật</asp:ListItem>
                        </asp:DropDownList></td>
                </tr>
                <tr>
                    <td>
                        Giới hạn người dùng
                    </td>
                    <td>
                        <asp:DropDownList ID="dropAuthorize" runat="server" Width="266px">
                            <asp:ListItem Value="0">Tất cả</asp:ListItem>
                            <asp:ListItem Value="1">Đại biểu</asp:ListItem>
                            <asp:ListItem Value="2">Quản trị viên</asp:ListItem>
                        </asp:DropDownList>
                    </td>
                </tr>
                <tr>
                    <td>
                        Hiển thị menu ngang</td>
                    <td>
                        <asp:CheckBox ID="chkTabMenu" runat="server" /></td>
                </tr>
                <tr>
                    <td>
                        Hiển thị danh sách trang chủ</td>
                    <td>
                        <asp:CheckBox ID="chkNavbar" runat="server" /></td>
                </tr>
                <tr>
                    <td>
                        Hiển thị tại mục tin ảnh</td>
                    <td>
                        <asp:CheckBox ID="chkTop" runat="server" /></td>
                </tr>
                <tr>
                    <td>
                        Hiển thị menu phải trên</td>
                    <td>
                        <asp:CheckBox ID="chkLeftBottom" runat="server" /></td>
                </tr>
                <tr>
                    <td>
                        Hiển thị menu phải dưới</td>
                    <td>
                        <asp:CheckBox ID="chkRightBottom" runat="server" /></td>
                </tr>
                <tr>
                    <td align="middle" colspan="2" style="height: 30px">
                        &nbsp;&nbsp;
                    </td>
                </tr>
                <tr>
                <td colspan="2">
                <asp:Button ID="cmdUpdate" runat="server" CssClass="Button" Text="Cập nhật" Width="79px"
                OnClick="cmdUpdate_Click" OnClientClick="return validateForm();" />
            <asp:Button ID="cmdAdd" runat="server" CssClass="Button" Text="Thêm" Width="79px"
                OnClick="cmdAdd_Click" OnClientClick="return validateForm();" />
            <asp:Button ID="cmdDel" runat="server" CausesValidation="False" CssClass="Button"
                Text="Xóa" Width="79px" OnClick="cmdDel_Click" />
            <asp:Button ID="cmdEmpty" runat="server" CausesValidation="False" CssClass="Button"
                Text="Hủy" Width="79px" OnClick="cmdEmpty_Click" /><br />
                </td>
                </tr>
                </table>
                </td>
                </tr>
            </table>
            &nbsp; &nbsp; &nbsp; &nbsp; 
            
        </td>
    </tr>
</table>
</contenttemplate>
</asp:UpdatePanel>